<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.panel.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.datagrid.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.messager.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/ext-for-framework.js.jsp"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/locale/easyui-lang-zh_CN.js"/>"></script>
<script type="text/javascript"
			src="<c:url value="/static/js/common.js"/>"></script>
<script type="text/javascript">

	function initList(listDisplayEId) {
		$('#' + listDisplayEId).datagrid(
				{
					nowrap : false,
					striped : true,
					collapsible : true,
					remoteSort : true,
					notSelectByRow : false,
					/* frozenColumns : [ [ {
						field : 'ids',
						checkbox : true
					} ] ], */
					toolbar : [
							],
					onLoadError : function() {
						$.messager.alert('错误', '获取数据失败，请与管理员联系！', 'error');
					},
					onClickRow :  function(rowIndex) {
									$(".myrad").prop("checked", false);
									$(".myrad").eq(rowIndex).prop("checked", true);
									$('#listDisplay').datagrid('beginEdit', rowIndex);
					            }
					}); 

	};
	$(document).ready(function() {
		initList('listDisplay');
	});
	function addMater(){
			$('#AddFoodForm').form('submit',
			{
				url:'<c:url value='/order/commitMaterOrderReal.do'/>', //查询提交路径
				onSubmit:function()//提交按钮相应函数
				{
					return $('#AddFoodForm').form('validate');
				},
				success:function(data){
					data = eval( "("+data+")" );
	       			if(data.success){
	       				$.messager.alert("提示", "提交成功！", 'info');
						$('#listDisplay').datagrid('reload');
    				}else{
    					var tmsg= ""
    					if(data.msg == "msg005"){
    	       				$.messager.alert("提示", "状态不正确，请确认材料订单状态是否为品级确认完毕", 'warning');
    					}else if(data.msg == "msg006"){
    						$.messager.alert("提示", "今日菜品价格还没有录入，请等待或联系采购部门。", 'warning');
    					}
    				}
				},
				error:function(){
					$.messager.alert("错误", "系统错误，请联系管理员！", 'error');
					return;
				}
			});
			
		}
		
</script>
</head>

<body>
    <form id="AddFoodForm" name="AddFoodForm" method="post">
		<table cellpadding="5">
			      <tr>
                    <td>
				        <input class="easyui-validatebox" type="hidden" name="ordId" required="true" validType="length[1,30]" value="${ordId }"/>
				        <input class="easyui-validatebox" type="hidden" name="materdategridList"  />
 			        </td>
                  </tr>
        </table>
    </form>

	<table id="listDisplay" title="材料列表" singleSelect=false
		iconCls="icon-list" idField="ordSupMaterId"
		url="<c:url value="/food/listFoodMaterDetailed.do?foodId=${foodId }"/>"
		style="width: 800px; width: 1180px;" loadMsg="请稍候......"
		pagination="false" pageSize="2"
		pageList="[2,10,20,30,40,50,100,150,200]" sortName="roleId"
		rownumbers="true" sortOrder="asc">
		<thead>
				<tr>
				    <th field="id" width="25" align="center"  checkbox="false">
					</th> 
					<th field="fmId" width="80"  sortable="true" hidden="true">
						关系Id
					</th>
					<th field="foodId" width="80"  sortable="true" >
						菜品ID
					</th>
					<th field="foodName" width="120"  sortable="true" >
						菜品名
					</th>	
					<th field="materId" width="80"  sortable="true" >
						材料ID
					</th>	
				    <th field="materName" width="120"  sortable="true" >
						材料名
					</th>	
					<th field="materWeight" width="120"  sortable="true" >
						所需材料重量（克）
					</th>	
 				</tr>
		</thead>
	</table>
</body>
</html>